const KoaRouter = require('koa-router')
const partService = require('../service/partService.js')
const auth = require('../middleware/auth.js')
const code = require('../common/code.js')

const router = new KoaRouter()

router.get('/partList', auth(['EDP']), async ctx => {
    ctx.body = code.getCode(code.SUCCESS, null, await partService.getList())
})

// router.post('/part', auth(['ADMIN']), async ctx => {
//     ctx.body = code.getCode(code.SUCCESS, null, await partService.insert(ctx.request.body))
// })

// router.get('/part/:id', auth(['ADMIN']), async ctx => {
//     ctx.body = code.getCode(code.SUCCESS, null, await partService.getAllByCounterId(ctx.params.id, ctx.session.user.store_id))
// })

// router.put('/part/:id', auth(['ADMIN']), async ctx => {
//     await partService.update(ctx.params.id, ctx.request.body)
//     ctx.body = code.getCode(code.SUCCESS)
// })

// router.delete('/part/:id', auth(['ADMIN']), async ctx => {
//     await partService.del(ctx.params.id)
//     ctx.body = code.getCode(code.SUCCESS)
// })

module.exports = router
